
import socketserver

class MyServer(socketserver.BaseRequestHandler):
    def handle(self):
        """
            所有的业务逻辑基本都在这里
        :return:
        """

        while 1:
            from_client_msg = self.request.recv(1024)
            print(from_client_msg.decode('utf-8'))
            to_client_msg = input('某某技师宝元说>>>').encode('utf-8')
            self.request.send(to_client_msg)
        # pass

if __name__ == '__main__':

    server = socketserver.ThreadingTCPServer(('127.0.0.1',8002),MyServer)
    server.serve_forever()
























